package com.xjnt.mnui.controller;

import com.xjnt.frameworks.annotation.AutoInject;
import com.xjnt.frameworks.annotation.Router;
import com.xjnt.frameworks.core.CRUDController;
import com.xjnt.mnui.entity.Card;
import com.xjnt.mnui.service.CardService;
import com.xjnt.mnui.service.CardUserService;
import com.xjnt.mnui.service.PortalService;

@Router(name="/mnui/ai/card", view="/mnui/card")
public class CardController extends CRUDController<Card, CardService> {

	@AutoInject
	private CardService cardService;
	
	@AutoInject
	private CardUserService cardUserService;
	
	@AutoInject
	private PortalService portalService;

	@Override
	protected String getBizName() {
		return "智能卡";
	}
	
	@Override
	protected Class<Card> getClazz() {
		return Card.class;
	}

	@Override
	protected CardService getService() {
		return cardService;
	}

	@Override
	protected void addBefore() {
		setAttr("cardUsers", cardUserService.findAll());
		setAttr("portals", portalService.findAll());
	}
	
	@Override
	public void editBefore(Card model) {
		addBefore();
	}
	
}
